package com.ch.http.v1.impl;

import com.ch.http.v1.HttpServletImp;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/hello.s")
public class HelloWorldServlet extends HttpServletImp {

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/html;charset=utf-8");
        String name = request.getParameter("name");
        if(name == null){
            name = "world";
        }
        response.getWriter().append("<h1>hello" + name +"</h1>");
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
        doGet(request,response);
    }


}
